<?php
namespace app\index\controller;

use think\Controller;
use think\Db;

class Login extends Controller
{


    public function login()
    {
        $rt=array();

        $username=input('userName');
        $password=input('userPwd');

        $where=array(
            'username'=>$username,
            'password'=>$password,
        );
        $res=Db::table('xt_user')->where($where)->find();
        if ($res){
            $rt['code']=1;
            $rt['massage']='登录成功！';
        }else{
            $rt['code']=-10001;
            $rt['massage']='用户名或密码错误！';
        }
        echo json_encode($rt);

    }


}
